package com.example.concurrent.ConcurrentNavigableMap;

import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;

/**
 * Created by Administrator on 2017/2/10 0010.
 */
public class ConcurrentNavigableMapDemo {

    public static void main(String[] args) {

        ConcurrentNavigableMap map = new ConcurrentSkipListMap();

        map.put("1", "one");
        map.put("2", "two");
        map.put("3", "three");

        ConcurrentNavigableMap headMap = map.headMap("2");
        ConcurrentNavigableMap tailMap = map.tailMap("2");
        ConcurrentNavigableMap subMap = map.subMap("2", "3"); //>=2,<3

        System.out.println(headMap.entrySet());
        System.out.println(tailMap.entrySet());
        System.out.println(subMap.entrySet());

    }
}
